/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ecfdb;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author SIDALI
 */
@Entity
@Table(name = "cajot", catalog = "mandataire", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Cajot.findAll", query = "SELECT c FROM Cajot c"),
    @NamedQuery(name = "Cajot.findByIdcajot", query = "SELECT c FROM Cajot c WHERE c.idcajot = :idcajot"),
    @NamedQuery(name = "Cajot.findByBombre", query = "SELECT c FROM Cajot c WHERE c.bombre = :bombre"),
    @NamedQuery(name = "Cajot.findByDate", query = "SELECT c FROM Cajot c WHERE c.date = :date"),
    @NamedQuery(name = "Cajot.findByTypeMouvement", query = "SELECT c FROM Cajot c WHERE c.typeMouvement = :typeMouvement")})
public class Cajot implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idcajot", nullable = false)
    private Integer idcajot;
    @Basic(optional = false)
    @Column(name = "bombre", nullable = false)
    private int bombre;
    @Basic(optional = false)
    @Column(name = "date", nullable = false)
    @Temporal(TemporalType.TIMESTAMP)
    private Date date;
    @Basic(optional = false)
    @Column(name = "type_mouvement", nullable = false, length = 7)
    private String typeMouvement;
    @JoinColumn(name = "acheteur", referencedColumnName = "idacheteur", nullable = false)
    @ManyToOne(optional = false)
    private Acheteur acheteur;

    public Cajot() {
    }

    public Cajot(Integer idcajot) {
        this.idcajot = idcajot;
    }

    public Cajot(Integer idcajot, int bombre, Date date, String typeMouvement) {
        this.idcajot = idcajot;
        this.bombre = bombre;
        this.date = date;
        this.typeMouvement = typeMouvement;
    }

    public Integer getIdcajot() {
        return idcajot;
    }

    public void setIdcajot(Integer idcajot) {
        this.idcajot = idcajot;
    }

    public int getBombre() {
        return bombre;
    }

    public void setBombre(int bombre) {
        this.bombre = bombre;
    }

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    public String getTypeMouvement() {
        return typeMouvement;
    }

    public void setTypeMouvement(String typeMouvement) {
        this.typeMouvement = typeMouvement;
    }

    public Acheteur getAcheteur() {
        return acheteur;
    }

    public void setAcheteur(Acheteur acheteur) {
        this.acheteur = acheteur;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idcajot != null ? idcajot.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Cajot)) {
            return false;
        }
        Cajot other = (Cajot) object;
        if ((this.idcajot == null && other.idcajot != null) || (this.idcajot != null && !this.idcajot.equals(other.idcajot))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "ecfdb.Cajot[ idcajot=" + idcajot + " ]";
    }
    
}
